package com.tenglong.user.controller;

import com.tenglong.user.pojo.SysUser;
import com.tenglong.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author chendongwei
 */
@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/rest/user" ,method = RequestMethod.GET)
    public String userList(HttpServletRequest request,Model model){
       List<SysUser> userList= userService.getUserList();
       model.addAttribute("users",userList);
       return "user_list";
    }

}
